package cn.marinda.listener;

import cn.marinda.gui.impl.SettingSelectServerCoreFileHelperImpl;
import cn.marinda.gui.impl.TipsNotCoresDialogImpl;
import cn.marinda.util.FileUtils;
import cn.marinda.util.SwingUtils;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

/**
 * 打开设置选择服务器核心文件事件
 *
 * @author marinda
 * @date 2022/08/02
 */
public class OpenSettingSelectServerCoreFileEvent implements ActionListener {
    @Override
    public void actionPerformed(ActionEvent e) {
            if(FileUtils.findLocationCores().size() <= 0){
                TipsNotCoresDialogImpl.instance.close();
                TipsNotCoresDialogImpl.instance.open();
                return;
            }
            SwingUtils.settingSelectServerCoreFileHelper = new SettingSelectServerCoreFileHelperImpl(FileUtils.findLocationCores());
            SwingUtils.settingSelectServerCoreFileHelper.close();
            SwingUtils.settingSelectServerCoreFileHelper.open();
    }
}
